package main

import (
	"fmt"
	"time"
)

type Phone interface {
	call()
}

type NokiaPhone struct {
}

func (nokiaPhone NokiaPhone) call() {
	fmt.Println("I am Nokia, I can call you!")
}

type IPhone struct {
}

func (iPhone IPhone) call() {
	fmt.Println("I am iPhone, I can call you!")
}

func say(world string) {
	for i := 0; i < 10; i++ {
		time.Sleep(100 * time.Millisecond)
		fmt.Printf("%s\n", world)
	}
}

func main() {
	/*var phone Phone
	phone = new(NokiaPhone)
	phone = new(IPhone)*/
	//go say("hello")
	//say("world")
	s := []int{2, 1, 4, 5, 6, 7, 9}

	fmt.Println(len(s) / 2)
	fmt.Println(s[len(s)/2:])
	/*c := make(chan int)
	go sum(s[:len(s)/2], c)
	go sum(s[len(s)/2:], c)

	x, y := <-c, <-c
	fmt.Println(x, y, x+y)*/
}

func sum(s []int, c chan int) {
	sum := 0
	for _, v := range s {
		sum += v
	}
	c <- sum
	close(c)
}
